//---------------------------------------------------------------------------- // File: D3DTypes.h // Class: D3DTypes [2.0] // Type: DirectX Types // Author: Ken Anderson // Date: 11/16/3 // OS dependant: Windows OS based on the fact that DirectX is windows only. // // Version: 1.0[11/16/03] -- Initial data types. // Version: 2.0[5/30/05] -- Removal of TP & VP type definitions. // Notes: Contains typedefs & other definitions specifically for Direct3d. // // Required headers: // 1) D3DX8.h -- DirectX8 3D header containing defintions and other direct3d requirements. // 2) TChar.h -- Windows TCharacter. //---------------------------------------------------------------------------- #ifndef __D3DTYPES #define __D3DTYPES #include #include #include //Safely releases an allocated com obj. #define SAFE_RELEASE(pObj) if(pObj){pObj->Release(); pObj = NULL;} //Safely releases a handle to an allocated com object. #define SAFE_HRELEASE(pObj) if(pObj){if(*pObj){(*pObj)->Release(); *pObj = NULL;}} /////////////////////// // DEFS // /////////////////////// //Modified 5/21/06 to use constants //#define MAXTEXTURES 5 //#define MAXDEVICES 2 const int MAXDEVICES=2; /////////////////////////////////// // D3D Device & Format Defs // /////////////////////////////////// const D3DDEVTYPE DevTypes[] = {D3DDEVTYPE_HAL, //Hardware device rendering. D3DDEVTYPE_REF}; //Reference/Software device rendering. LPTSTR const pStrDevDesc[] = {_T("HAL"), _T("REF")}; //Make sure the values are CONST, not the pointers. const DWORD dwNumDepths = 7L; //Amount of Depths available. const D3DFORMAT DepthStencilFormats[] = {D3DFMT_D16_LOCKABLE, //16-bit lockable z-buffer. D3DFMT_D16, //16-bit z-buffer D3DFMT_D15S1, //16-bit z-buffer {15-bit depth buffer, 1-bit Stencil} D3DFMT_D24X8, //32-bit z-buffer {24-bit depth buffer} D3DFMT_D24X4S4, //32-bit z-buffer {24-bit depth buffer, 4-bit Stencil} D3DFMT_D24S8, //32-bit z-buffer {24-bit depth buffer, 8-bit Stencil} D3DFMT_D32, //32-Bit z-buffer }; const DWORD dwNumTextures = 11L; //Amount of Textures available. const D3DFORMAT TextureFormats[] = {D3DFMT_R8G8B8, //24-bit RGB format. D3DFMT_A8R8G8B8, //32-bit ARGB format w/alpha. D3DFMT_X8R8G8B8, //32-bit RGB format, 8 bits per color. D3DFMT_R5G6B5, //16-bit RGB format. D3DFMT_X1R5G5B5, //16-bit format, 5 bits per color. D3DFMT_A1R5G5B5, //16-bit format, 5 bits per color, 1 bit per alpha. D3DFMT_A4R4G4B4, //16-bit ARGB format w/alpha. D3DFMT_R3G3B2, //8-bit RGB format. D3DFMT_A8, //8-bit Alpha format only. D3DFMT_A8R3G3B2, //16-bit ARGB texture format. D3DFMT_X4R4G4B4}; //16-bit RGB, 4 bits per color. typedef D3DDISPLAYMODE MODE; typedef MODE* PMODE; typedef struct STENCIL_DEPTH_FORMAT_EX { D3DFORMAT d3dFormat; //The format supporting the following stencildepth formats. BYTE byNumStencilDepths; //The number of stencils available. D3DFORMAT* pStencilDepthFormats; //The depth & stencil available for this mode. } STENCILS, *PSTENCILS; //Devices are HAL, REF or SW. typedef struct DEVICE_INFORMATION_EX { //Device information D3DDEVTYPE type; //Device Type D3DCAPS9 d3dcaps; //Capabilities of the card. const TCHAR* pstrDesc; //Description of the device BOOL bWindowCapable; //True if it can window. BOOL bWindowed; //Is the device in window mode. DWORD dwBehavior; //Behavior of the device(Hardware VP, Software VP, Mixed VP). //Mode information. DWORD dwNumModes; //The number of modes supported under this device. DWORD dwCurrMode; //The current mode being used. PMODE pModes; //A list of modes available on this device. //StencilDepth Format. BYTE byNumStencils; //Number of Stencils. D3DFORMAT d3dCurrStencil; //Current Stencil to be used for this device. PSTENCILS pStencils; //A list of stencils and the format that supports them. } DEVICE, *PDEVICE; //Hardware adapter. typedef struct ADAPTER_INFORMATION_EX { D3DDISPLAYMODE desktop; //Desktop mode information. DEVICE devices[MAXDEVICES]; //A list of the three devices normally supported under an adapter. BYTE byNumDevices; //The amount of devices available. BYTE byCurrDevice; //The current device that is being used by this adapter. BOOL bHALsupport; //True if HAL is supported. } ADAPTER, *PADAPTER; #endif